<?php
/**
 * Created by PhpStorm.
 * User: allen_ios
 * Date: 17/4/24
 * Time: 上午11:09
 */

class RestaurantPrintSetModel extends BaseModel
{
    protected $tableName = 'restaurant_print_set';

    /**
     * 获得设置信息
     * @param int $resId    餐饮打印配置id
     * @return mixed
     */
    public function getBaseInfo($sId)
    {
        $cacheKey = 'restaurant_print_set_'.$sId;

        //先从缓存中获取数据
        $cacheData = RedisService::hget($cacheKey);
        if ($cacheData) {
            return $cacheData;
        }

        //获得配置信息
        $condition = array(
            'sid' => $sId
        );
        $data = $this->getInfo($condition,'*',null,null,null);
        if (!$data) {
            return null;
        }

        //设置缓存信息
        RedisService::hset($cacheKey,$data,86400);
        return $data;
    }
}